package cn.dlust.tt.module.teacher.dal.mysql.courses;

import java.util.*;

import cn.dlust.tt.framework.common.pojo.PageResult;
import cn.dlust.tt.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.dlust.tt.framework.mybatis.core.mapper.BaseMapperX;
import cn.dlust.tt.module.teacher.dal.dataobject.courses.CoursesDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 课程 Mapper
 *
 * @author 王老师
 */
@Mapper
public interface CoursesMapper extends BaseMapperX<CoursesDO> {

    default PageResult<CoursesDO> selectPage(cn.dlust.tt.module.teacher.controller.admin.courses.vo.CoursesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CoursesDO>()
                .likeIfPresent(CoursesDO::getCourseName, reqVO.getCourseName())
                .eqIfPresent(CoursesDO::getTeacherId, reqVO.getTeacherId())
                .eqIfPresent(CoursesDO::getDeptId, reqVO.getDeptId())
                .likeIfPresent(CoursesDO::getDescription, reqVO.getDescription())
                .eqIfPresent(CoursesDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(CoursesDO::getId));
    }

}